<template>
    <div id="home">
        <h2>这是Myhome组件</h2>
        <h2>{{$store.state.count}}</h2>
        <button @click="add">+5</button>
        <button @click="AsyAdd">异步+1</button>
    </div>
</template>

<script>
export default {
    methods: {
        add(){
            //触发mutations中的函数
            this.$store.commit('increment',5)
        },
        AsyAdd(){
            //触发action函数,并且传参
            this.$store.dispatch('asyncIcrement',10)
        }
    }
}
</script>

<style>
    #home{
        border: 1px solid red;
    }
</style>